#ifndef _E_PH_SCENE_H_
#define _E_PH_SCENE_H_

#include "EPhActor.h"
#include "EPhMaterial.h"
#include "EVector.h"
#include "EPhController.h"

#include "eH.h"
namespace engine
{
class EPhControllerManager;

//------------------------------------------------------------
class EPhSceneDesc
{
  EVector       m_vGravity;
public:
  EPhSceneDesc();
  const NxSceneDesc getNxSceneDesc() const;
};

//------------------------------------------------------------
class EPhScene
{
  const EPhSceneDesc      m_SceneDesc;
  EPhControllerManager*   m_pPhControllerManager;
  NxScene*                m_pNxScene;
  vector<EPhActor*>       m_vActors;
  vector<EPhMaterial*>    m_vMaterials;
  static const float      s_fDefaultTimeStep;
  static const int        s_iNbSubSteps;
  NxReal                  m_fTimeStep;
public:
  EPhScene( const EPhSceneDesc& sceneDesc );
  ~EPhScene();

  bool      init();
  void      release();
  bool      startSimulationComputing              (const EGameTime& gameTime);
  bool      endSimulationComputing                ();
  bool      isSimulationComputingEnded            () const;

  void      setGravity  ( const EVector& vGravity );
  /** 
   * \return NULL if cannot create an actor
   */
  EPhActor* createActor ( const EPhActorDesc& actorDesc );
  void      destroyActor( EPhActor& actor );

  /** 
  * \return NULL if cannot create an actor
  */
  EPhController*  createController    ( const EPhControllerDesc& controllerDesc );
  void            destroyController   ( EPhController& controller );

  /** 
  * \return NULL if cannot create a material
  */
  EPhMaterial* createMaterial(const EPhMaterialDesc& matDesc );

  inline NxScene* getNxScenePtr() const { return m_pNxScene; }
};

} // end namespace

#endif 